<?php

global $_GPC, $_W;

$GLOBALS['frames'] = $this->getMainMenu();
$cates = pdo_getall('snx_unit',array('uniacid'=>$_W['uniacid'],'id'=>$_GPC['id']));
$info = pdo_get('snx_task',array('id'=>$_GPC['id']));
 if (checksubmit('submit')) {
        $data['title']=$_GPC['title'];
        $data['video']=$_GPC['video'];
        $data['unit_id']=$_GPC['name'];
        $data['thumb']=$_GPC['thumb'];
        $data['describe']=$_GPC['describe'];
        $data['voice']=$_GPC['voice'];
        $data['create_time']=date('Y-m-d H:i:s',time());
        $data['uniacid']=$_W['uniacid'];
        if (empty($_GPC['title'])) {
            message('题目不能为空','','error');

        }if (empty($_GPC['name'])) {

            message('课节不能为空','','error');

        }

        $rst=pdo_insert('snx_task',$data);      

        if($rst){


             message('添加成功！', $this->createWebUrl('task',array('id'=>$_GPC['name'])), 'success');

        }else{

             message('添加失败！','','error');

        }

}

include $this->template('web/addtask2');

 ?>